<?
	class Hero 
	{
		var $hero;
		
		function __construct($battle_tag, $id) 
		{
			$url = 'http://us.battle.net/api/d3/profile/' . $battle_tag . '/hero/' . $id;
			
			$hero = json_decode(file_get_contents($url));
			
			$this->hero = $hero;
		}
		
		function __get($name) 
		{
			return $this->hero->$name;
		}
	}	
	
	if($_GET['battle_tag'] && $_GET['id'])
	{		
		header('Content-type: application/json');
		$hero = new Hero($_GET['battle_tag'], $_GET['id']);
		echo json_encode($hero->hero);
	}
?>